﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ElectronicCommerce.Framework.Web.Validation
{
    public abstract class FormEntityBase : IFormEntityValidatable
    {

        #region IFormEntityValidatable Members

        public bool Validate(out IEnumerable<string> errorMessages)
        {
            IFormEntityValidator validator = GetValidator();

            errorMessages = validator.PopulateErrorMessages();

            return validator.IsValid();
        }

        public abstract IFormEntityValidator GetValidator();

        #endregion
    }
}
